import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control

// 倒入全局组件
import cmts from './components'
Vue.use(cmts)

// 全局过滤器
import * as filters from './filters'
for (const key in filters) {
  Vue.filter(key,filters[key])
}
// 打印机
import Print from 'vue-print-nb'
// Global instruction
Vue.use(Print);

// 全局混入
import { roleAdd } from '@/mixins'

Vue.mixin(roleAdd)

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */

// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明

import i18n from '@/i18n/index'

Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value)
})

Vue.config.productionTip = false

// 导入自定义属性
import * as obj from './directives'
import { userInfo } from './api/user'
// console.log(obj);
for (let key in obj) {
  Vue.directive(key, obj[key])
}



new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})
